package com.zhangsun.system.controller;

import com.zhangsun.base.bean.ResponseData;
import com.zhangsun.common.utils.ResponseUtil;
import com.zhangsun.system.dto.UserDto;
import com.zhangsun.system.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登陆
 */
@RestController
public class LoginController {

    @Autowired
    private LoginService loginService;

    /**
     * 登陆
     *
     * @param username 用户工号
     * @param password 密码
     * @return 结果
     */
    @RequestMapping(value = "/login")
    public ResponseData login(String username, String password) {
        UserDto userDto = loginService.login(username, password);
        return ResponseUtil.success(userDto);
    }

}
